# Makefile for libdgnsc
# Copyright (C) 2009-2010 drangon <drangon.zhou@gmail.com>
# 2009-05
# 
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.


TARGET = test.exe
SRCS = $(wildcard *.cpp)

OBJS = $(foreach src, $(SRCS), $(basename $(src)).o)
DEPS = $(foreach src, $(SRCS), $(basename $(src)).zzdep)

AR = ar
CXX = g++
CFLAGS += -Wall -pipe -fno-rtti -fno-exceptions -I../ 
LDFLAGS += -L../ -ldgnsc

ifeq ($(strip $(OS)),Windows_NT)
CFLAGS += -s
LDFLAGS += -lwinmm -lws2_32
else
LDFLAGS += -lpthread -lrt -lm
endif

.PHONY : all clean test

all : $(TARGET)

# $(CXX) $(CFLAGS) -x c++-header libtestfc.h

clean :
	rm -f $(TARGET) *.o *.zzdep

$(TARGET) : ../libdgnsc.a

$(TARGET) : $(OBJS)
	$(CXX) $(CFLAGS) -o $@ $(OBJS) $(LDFLAGS)


.SUFFIXES : .cpp

.cpp.o :
	$(CXX) $(CFLAGS) -MMD -MF $*.zzdep -c -o $@ $<

-include $(DEPS)

